package com.hymall.controller.wx;

import com.hymall.bean.MarketUser;
import com.hymall.bean.common.BaseRespVo;
import com.hymall.bean.vo.WxUserIndexVO;
import com.hymall.service.wx.WxUserService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: 章鹏
 * @description 用户（登录后） → 个人中心
 * @date: 2022/7/19 9:33
 */
@RestController
@RequestMapping("wx/user")
public class WxUserController {
    @Autowired
    WxUserService wxUserService;
    /**
     * @author 章鹏
     * @description 用户（登录后） → 个人中心
     * @date 2022/7/19 9:45
     * @param []
     * @return com.hymall.bean.common.BaseRespVo
     */
    @GetMapping("index")
    public BaseRespVo index(){
        Subject subject = SecurityUtils.getSubject();
        MarketUser marketUser = (MarketUser) subject.getPrincipal();
        WxUserIndexVO wxUserIndexVO = wxUserService.index(marketUser);
        return BaseRespVo.ok(wxUserIndexVO);
    }
}
